Hello,
I need write a new script. In this third script execution of the SecondScript depends result of first, like this : if FisrtScript.dxl is true then execute SecondScript.dxl. I don't find how to do. Is it possible ? Thanks Pierre PDU - Mon Mar 15 05:38:01 EDT 2010 |
Re: Conditional execution of script inside script
if you put the whole of your first script into a separate boolean function, which returns true if it suceeds succesfully. (I would also be tempted to save this new function in a separate include file.
bool firstScript {
firstScript.dxl
return true - if criteria met for firstScript
}
<#include firstScript.inc>
<#include secondScript.inc>
if (firstScriptBoolFunction) {
secondScriptFunction.inc>
}
|
Re: Conditional execution of script inside script Ben_Sharples - Mon Mar 15 07:08:24 EDT 2010
if you put the whole of your first script into a separate boolean function, which returns true if it suceeds succesfully. (I would also be tempted to save this new function in a separate include file.
bool firstScript {
firstScript.dxl
return true - if criteria met for firstScript
}
<#include firstScript.inc>
<#include secondScript.inc>
if (firstScriptBoolFunction) {
secondScriptFunction.inc>
}
it works fine, for some scripts. My first script use DBE, and DB variables (panel with fields). ==> errors, i need declare DBE variables outside firstScript function. But my second scripts use crypted include, so i have "non local variable access" messages, and no solution. Pierre |
Re: Conditional execution of script inside script PDU - Mon Mar 15 09:49:38 EDT 2010
There is a special pattern on how remote control (start) a gui script from another script and evaluate the results.
// --- firstscript.dxl ----
DB diag
DBE dbeField
void makeDiag(int x) {
diag = centered "First Script"
dbeField = field(diag, "", x "", 30, false)
}
makeDiag(10)
show diag
// --- secondScript.dxl ---
ack "The user entered 10."
// ----------- thirdscript.dxl -----------
// trick: redeclare the show method to enable us
// to continue after firstscript
void show(DB x) {
block x
}
#include <firstScript.dxl>
// here we use the global variables of the first script!
release diag
hide diag
string val = get dbeField
// condition for secondscript
if (val != 10) halt
#include <secondScript.dxl>
// you could have done something like this:
// if (val == 10) { eval_ "#include <secondScript.dxl>" }
|
Re: Conditional execution of script inside script Mathias Mamsch - Mon Mar 15 18:09:45 EDT 2010
There is a special pattern on how remote control (start) a gui script from another script and evaluate the results.
// --- firstscript.dxl ----
DB diag
DBE dbeField
void makeDiag(int x) {
diag = centered "First Script"
dbeField = field(diag, "", x "", 30, false)
}
makeDiag(10)
show diag
// --- secondScript.dxl ---
ack "The user entered 10."
// ----------- thirdscript.dxl -----------
// trick: redeclare the show method to enable us
// to continue after firstscript
void show(DB x) {
block x
}
#include <firstScript.dxl>
// here we use the global variables of the first script!
release diag
hide diag
string val = get dbeField
// condition for secondscript
if (val != 10) halt
#include <secondScript.dxl>
// you could have done something like this:
// if (val == 10) { eval_ "#include <secondScript.dxl>" }
Thanks very much Mathias, this works fine. eval_ "#include <secondScript.dxl>"
. #include <secondScript.dxl>
, after execution of this script, DOORS is blocked (ALT-CTRL-DEL !). |
Re: Conditional execution of script inside script PDU - Wed Mar 17 03:09:15 EDT 2010
Thanks very much Mathias, this works fine. eval_ "#include <secondScript.dxl>"
. #include <secondScript.dxl>
, after execution of this script, DOORS is blocked (ALT-CTRL-DEL !).
There are usually three reasons why a DOORS script locks up:
void show(DB x) {
block x
// get data from the main dialog here if you need to
// ...
release x
}
|